import axios, {ResponseData} from 'yuxin-base/src/utils/axios'

/**
 * 获取图片
 * @param data
 * @returns
 */
export const getImgById = (data: string): Promise<ResponseData> => {
	return axios.request({
		url: `/oss/upload_file/get_by_biz_id/${data}`,
		method: 'GET'
	})
}

/**
 * 注册修改主体
 * @param data
 * @returns
 */
export const orgInfoRegister = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/org_info/register',
		data,
		method: 'POST'
	})
}

/**
 * 保存-修改主体
 * @param data
 * @returns
 */
export const saveOrUpdate = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/org_info/save_or_update',
		data,
		method: 'POST'
	})
}
/**
 * 启用禁用主体
 * @param data
 * @returns
 */
export const orgInfoUpdateDisableStatus = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/org_info/update_disable_status',
		data,
		method: 'POST'
	})
}
/**
 * 主体列表
 * @param data
 * @returns
 */
export const orgInfoPages = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/org_info/pages',
		data,
		method: 'POST'
	})
}
/**
 * 可选择主体列表
 * @param data
 * @returns
 */
export const orgInfoAvailableList = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/org_info/available_list',
		data,
		method: 'POST'
	})
}
/**
 * 费用类型
 * @param
 * @returns
 */
export const listDict = (): Promise<ResponseData> => {
	return axios.request({
		url: '/system/dictionary/list_dict/FEESUBJECT',
		method: 'GET'
	})
}

/**
 * 可选择主体列表
 * @param data
 * @returns
 */
export const subjectEnterpriseCert = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/org_info/available_list',
		data,
		method: 'POST'
	})
}
/**
 * 主体状态统计
 * @param data
 * @returns
 */
export const orgInfoCounts = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/org_info/counts',
		data,
		method: 'POST'
	})
}

/**
 * 根据税号查询企业主体详情
 * @param data
 * @returns
 */
export const orgInfoSpi = (data: string): Promise<ResponseData> => {
	return axios.request({
		url: `/finance/invoice/org_info/spi/${data}`,
		method: 'GET'
	})
}

/**
 * 根据id查询企业主体详情
 * @param data
 * @returns
 */
export const orgInfoId = (data: string): Promise<ResponseData> => {
	return axios.request({
		url: `/finance/invoice/org_info/${data}`,
		method: 'GET'
	})
}
/**
 * 添加发票信息
 * @param data
 * @returns
 */
export const departmentConfigAdd = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/department_config/add',
		data,
		method: 'POST'
	})
}
/**
 * 修改发票信息
 * @param data
 * @returns
 */
export const departmentConfigUpdate = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/department_config/update',
		data,
		method: 'POST'
	})
}
/**
 * 启用/禁用发票信息
 * @param data
 * @returns
 */
export const updateDisableStatus = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/department_config/update_disable_status',
		data,
		method: 'POST'
	})
}

/**
 * 分页查询发票信息
 * @param data
 * @returns
 */
export const departmentConfigPages = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/department_config/pages',
		data,
		method: 'POST'
	})
}
/**
 * 发票信息状态统计
 * @param data
 * @returns
 */
export const departmentConfigStatusCounts = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/department_config/status_counts',
		data,
		method: 'POST'
	})
}

/**
 * 删除发票信息
 * @param data
 * @returns
 */
export const departmentConfigRemove = (data: string): Promise<ResponseData> => {
	return axios.request({
		url: `/finance/invoice/department_config/remove/${data}`,
		method: 'DELETE'
	})
}
/**
 * 发票信息详情
 * @param data
 * @returns
 */
export const departmentConfig = (data: string): Promise<ResponseData> => {
	return axios.request({
		url: `/finance/invoice/department_config/${data}`,
		method: 'GET'
	})
}

/**
 * 模糊查询企业
 * @param data
 * @returns
 */
export const spiNameMatching = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/org_info/spi/name_matching',
		data,
		method: 'POST'
	})
}
/**
 * 获取部门门店列表
 * @param data
 */
export const departmentListStore = (): Promise<ResponseData> => {
	return axios.request({
		url: '/system/department/get_dept_tree',
		method: 'GET'
	})
}
/**
 * 获取税盘号+终端号
 * @param data
 */
export const spiExtensionInfo = (data: string): Promise<ResponseData> => {
	return axios.request({
		url: `/finance/invoice/org_info/spi/extension_info/${data}`,
		method: 'GET'
	})
}
/**
 * 获取发票限额
 * @param data
 */
export const invoiceMaxValue = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/org_info/spi/invoice_max_value',
		data,
		method: 'POST'
	})
}

/**
 * 获取发票信息列表
 * @param data
 */
export const departmentConfigList = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/department_config/list',
		data,
		method: 'POST'
	})
}
/**
 * 获取发票信息详情
 * @param data
 */
export const departmentConfigDetails = (data: string): Promise<ResponseData> => {
	return axios.request({
		url: `/finance/invoice/department_config/${data}`,
		method: 'GET'
	})
}

/**
 * 查询已配置主要部门
 * @param data
 */
export const getDepartmentId = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/department_config/list',
		data,
		method: 'post'
	})
}
